//
//  AWTextChatMessage.m
//  AtWork2
//
//  Created by lucas on 15/5/28.
//  Copyright (c) 2015年 Foreveross. All rights reserved.
//

#import "AWTextChatMessage.h"

@implementation AWTextChatMessage

+ (instancetype)textChatMessageWithFrom:(NSString *)from
                                 to:(NSString *)to
                            content:(NSString *)content
                       chatDestType:(AWChatDestType)chatDestType {
    return [[self alloc] initWithFrom:from to:to content:content chatDestType:chatDestType];
}

+ (instancetype)textServceAppMessageWithFrom:(NSString *)from
                                          to:(NSString *)to
                                     content:(NSString *)content {
    return [[self alloc] initServceAppWithFrom:from to:to content:content];
}

- (instancetype)initServceAppWithFrom:(NSString *)from to:(NSString *)to content:(NSString *)content {
    if (self = [super initWithFrom:from to:to messageType:AWMessageTypeServeNo]) {
        self.content = content;
        self.chatMessageType = AWChatMessageTypeText;
        self.text_type = AWTextChatMessageTypeNormal;
    }
    return self;
}

- (instancetype)initWithFrom:(NSString *)from
                          to:(NSString *)to
                     content:(NSString *)content
                chatDestType:(AWChatDestType)chatDestType {
    
    if (self = [super initWithFrom:from to:to messageType:AWMessageTypeChat]) {
        self.chatDestType = chatDestType;
        self.content = content;
        self.chatMessageType = AWChatMessageTypeText;
        self.text_type = AWTextChatMessageTypeNormal;
    }
    return self;
}

- (void)setContent:(NSString *)content {
    [self bodyWithKey:AWMessageKContent value:content];
}

- (NSString *)content {
    return [self bodyValueForKey:AWMessageKContent];
}

- (void)setText_type:(NSUInteger)text_type {
    [self bodyWithKey:AWMessageTextType value:@(text_type)];
}

- (NSUInteger)text_type {
    return [[self bodyValueForKey:AWMessageTextType] unsignedIntegerValue];
}

- (void)setAt_Contacts:(NSDictionary *)at_Contacts {
    [self bodyWithKey:AWMessageAtContacts value:at_Contacts];
}

- (NSDictionary *)at_Contacts {
    return [self bodyValueForKey:AWMessageAtContacts];
}

- (NSString *)searchableContent {
    return self.content;
}

@end
